<template>
  <div class="box">
    <div class="listTop">
      <div
        class="blur"
        :style="{ backgroundImage: `url(${$root.musicStore.picUrl})` }"
      ></div>
      <router-link to="/musichome">
        <van-icon
          name="revoke"
          style="text-shadow: 0 0 0.2em black"
          color="white"
          size="30"
        />
      </router-link>
    </div>
    <Loading v-if="songs == null"></Loading>

    <ul class="song" v-if="songs != null">
      <p>歌单列表</p>
      <li class="li" v-for="(s, index) in songs" :key="s.id">
        <span>{{ index + 1 }}</span>
        <SongItem :item="s"></SongItem>
      </li>
    </ul>
  </div>
</template>

<script>
import Loading from "@/components/myLoading";
import SongItem from "@/components/SongItem";
export default {
  data() {
    return {
      arID: null,
      songs: null,
      picurl: null,
      text: null
    };
  },
  components: {
    SongItem,
    Loading
  },
  methods: {
    clearList() {
      this.songs = null;
    }
  },
  created() {
    this.arID = this.$route.params.id;
    this.$root.musicStore.picUrl = this.$route.query.url;
    this.$root.musicStore.text = this.$route.query.name;
    this.$axios.get("/artists?id=" + this.arID).then(data => {
      this.songs = data.data.hotSongs;
    });
  }
};
</script>

<style lang="less" scoped>
.song {
  p {
    font-size: 13px;
    margin: 10px 0;
    padding-left: 10px;
    // background-color: rgb(238, 239, 240);
  }
}
.listTop {
  position: relative;
  width: 100vw;
  height: 250px;
  display: flex;
  padding: 0 20px;
  background-size: 100%;
  justify-content: flex-start;
  align-items: center;
  .blur {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position-y: -50px;
    background-repeat: no-repeat;
  }
  a {
    position: absolute;
    top: 5px;
    right: 10px;
    z-index: 1;
  }
  img {
    width: 145px;
    height: auto;
    z-index: 1;
  }
}
.li {
  display: flex;
  &:first-of-type {
    span {
      color: yellow;
    }
  }
  &:nth-of-type(2) {
    span {
      color: #c0c0c0;
    }
  }
  &:nth-of-type(3) {
    span {
      color: rgb(233, 183, 124);
    }
  }
  span {
    display: inline-block;
    line-height: 50px;
    margin: 0 8px;
    color: rgb(240, 240, 240);
  }

  div {
    flex: 1;
  }
}
</style>
